/* -----------------------------------------------------------------------------
 * PROJECT    : lwf_handlers
 * FILE       : FractionHandlerHelper.java
 *
 * HISTORY:
 * Date          Author                        Description
 * ----------------------------------------------------------------------------- 
 * Mar 17, 2011  mycodetalks			       Created
 */
package net.lwf.handler.math.fraction.helper;

import net.lwf.jaxb.entity.Fraction;
import net.lwf.pdf.util.PdfPCellUtil;

import com.itextpdf.text.BaseColor;
import com.itextpdf.text.Element;
import com.itextpdf.text.pdf.PdfPCell;
import com.itextpdf.text.pdf.PdfPTable;

/**
 * Class description goes here
 */
public class FractionHandlerHelper {
	
	public static PdfPTable generatePDfTable(Fraction fraction) {
		PdfPTable table = new PdfPTable(1);
		//1st row
		PdfPCell cell = PdfPCellUtil.getCell(String.valueOf(fraction.getNumerator()));
		cell.setHorizontalAlignment(Element.ALIGN_CENTER);
		table.addCell(cell);
		//2nd row
		cell = PdfPCellUtil.getEmptyCell();
		cell.setBorderColorBottom(BaseColor.BLACK);
		cell.setBorderWidthBottom(2);
		table.addCell(cell);
		//3rd row
		cell = PdfPCellUtil.getCell(String.valueOf(fraction.getDenominator()));
		cell.setHorizontalAlignment(Element.ALIGN_CENTER);
		cell.setNoWrap(true);
		table.addCell(cell);
		
		return table;
	}

}



